<template>
	<view class="content">
		<navbar title='库存产品'>
		</navbar>
		<view class="content">
			<u-sticky offset-top="0">
				<view class="tuanone">
					<u-tabs style="width: 100%;" :list="classlist" active-color="#1A1A1A" inactive-color="#666666" :is-scroll="true" :current="current" @change="change"></u-tabs>
				</view>
			</u-sticky>
			<view class="menlist">
				<view class="menitem" v-for="(item,index) in 3" :key="index">
					<image class="tu" :src="ossThree('/uploads/20250404/a6740382ebb9492d9ed8c12c1e42d198.png')" />
					<view class="menone">
						<view class="menhead">
							<text class="name">东方蓉妍(天明路店)</text>
						</view>
						<view class="menhead mennav">
							<text class="ju">￥19.9</text>
							<u-number-box class="ml" v-model="value"></u-number-box>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="botview">
			<view class="tjia">确认</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {
		},
		data() {
			return {
				list: [{
					name: '全部'
				}, {
					name: '水光美白'
				}, {
					name: '光学仪器'
				},{
					name: '全部'
				}, {
					name: '水光美白'
				}, {
					name: '光学仪器'
				},{
					name: '全部'
				}, {
					name: '水光美白'
				}, {
					name: '光学仪器'
				},{
					name: '全部'
				}, {
					name: '水光美白'
				}, {
					name: '光学仪器'
				}],
				current: 0,
				value:1,
				ishead:1,//我的库存 2官方进货
			}
		},
		onLoad(option) {
			if(option.shop_id){
				this.shop_id = option.shop_id
			}
			this.getcate();//分类

		},
		onShow() {
		},
		methods: {
			async getcate() {
				let res = await this.$u.api.getCate({
				});
				let a = {
					id:99,
					name:'我的'
				}
				let shuzu = res
				shuzu = res
				shuzu.unshift(a)
				this.classlist = shuzu
				console.log(this.classlist)
				if(this.classitem==''||!this.classitem){
					this.classitem = this.classlist[0]
				}
				this.getList();//数据合集
			},
			closeteam(){
				this.teampopshow = false
			},
			change(index) {
				this.current = index;
				this.classitem = this.classlist[index]
				this.getClear()
			},
			getdetail(item){
				this.navrouter('/pages_client/mine/OrderDetail')
			},
			closeshai(){
				this.shaipopshow = false
			},
			async getList(){//列表数据
				if(this.ishead == 1){
					let res = await this.$u.api.getShopGoodsList({
						limit:this.limit,
						page:this.page,
						shop_id:this.shop_id,
						cid:this.classitem.id
					});
					this.last_page = res.lastpage
					let list = res.list;
					this.list = this.page == 1 ? list : [...this.list, ...list];	
					if(res.list==''||Number(list.length)<Number(this.limit)||Number(this.page)>Number(this.last_page)){
						this.status = 'nomore';
					}
				}else if(this.ishead == 2){
					let res = await this.$u.api.getGuanGoodsList({
						limit:this.limit,
						page:this.page,
						shop_id:this.shop_id,
						cid:this.classitem.id
					});
					this.last_page = res.lastpage
					let list = res.list;
					this.list = this.page == 1 ? list : [...this.list, ...list];	
					if(res.list==''||Number(list.length)<Number(this.limit)||Number(this.page)>Number(this.last_page)){
						this.status = 'nomore';
					}
				}
				
				
			},
			loadmore() {
				let page = this.page;
				// let last_page = this.last_page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},
			getClear(){
				this.list = []
				this.page = 1,
				this.status= "loadmore"
				this.getList()
			},
			closeteam(){
				this.teampopshow = false
			},
			change(index) {
				this.current = index;
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #f9f9f9;
	}
	.content{
		background-color: #f9f9f9;
		padding-bottom: 130rpx;
		.tuanone{
			background-color: #fff;
			padding: 15rpx 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			width: 100%;
			.tuhead{
				max-width: 80%;
				white-space: nowrap;
				.tuitem{
					padding: 8rpx 20rpx;
					background: #F5F5F5;
					border-radius: 10rpx;
					margin-right: 20rpx;
					font-weight: 500;
					font-size: 26rpx;
					color: #333333;
					display: inline-block;
				}
				.tactive{
					background: #52443B;
					color: #fff;
				}
			}
			.icon_tx{
				margin-left: auto;
				width: 40rpx;
				height: 40rpx;
			}
		}	
	}
	.nlist{
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		.nitem{
			padding: 20rpx 25rpx;
			background: #FFFFFF;
			border-radius: 30rpx;
			.nione{
				display: flex;
				flex-direction: row;
				align-items: center;
				.tous{
					width: 81rpx;
					border-radius: 50%;
					height: 81rpx;
					margin-right: 15rpx;
				}
				.niright{
					width: 82%;
					display: flex;
					flex-direction: column;
					.rione{
						display: flex;
						flex-direction: row;
						align-items: center;
						.riname{
							max-width: 80%;
							display: inline-block;
							font-weight: bold;
							font-size: 32rpx;
							color: #333333;
						}
						.hyuan{
							width: 80rpx;
							height: 32rpx;
							background: linear-gradient(-90deg, #272727, #4D4D4D);
							border-radius: 6rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							font-weight: 500;
							font-size: 22rpx;
							color: #FFFFFF;
							margin-left: 10rpx;
						}
						.idname{
							font-weight: 400;
							font-size: 24rpx;
							color: #999999;
						}
						.hui{
							margin-left: 40rpx;
						}

					}
					.mttwo{
						margin-top: 15rpx;
					}
				}
				.comm_icon_next{
					margin-left: auto;
					width: 24rpx;
					height: 24rpx;
				}
			}
			.zheview{
				border-top: 1rpx solid #eee;
				display: flex;
				flex-direction: column;
				margin-top: 20rpx;
				padding-top: 20rpx;
				.zheitem{
					display: flex;
					flex-direction: row;
					flex-wrap: wrap;
					.items{
						width: 50%;
						display: flex;
						flex-direction: row;
						align-items: center;
						margin-bottom: 10rpx;
						.ileft{
							font-weight: 500;
							font-size: 24rpx;
							color: #999999;
						}
						.ival{
							font-weight: 500;
							font-size: 26rpx;
							color: #333333;
						}
					}
				}
				.shengbtn{
					display: flex;
					flex-direction: row;
					justify-content: flex-end;
					padding: 0 20rpx 20rpx 0;
					.sbtn{
						padding: 15rpx 25rpx;
						background: #52443B;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
						font-weight: bold;
						font-size: 28rpx;
						color: #FFFFFF;
						margin-left: 20rpx;
					}
				}
			}
		}
	}
	.botview{
		position: fixed;
		height: 120rpx;
		width: 100%;
		bottom: 0;
		background-color: #fff;
		z-index: 10;
		padding: 0 30rpx;
		display: flex;
		align-items: center;
		.tjia{
			width: 100%;
			height: 90rpx;
			background: #52443B;
			border-radius: 16rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-weight: bold;
			font-size: 28rpx;
			color: #FFFFFF;
		}
	}
	.menlist{
		padding:30rpx 0;
	}
	.menitem{
                display: flex;
                flex-direction: row;
                align-items: center;
                background: #FFFFFF;
                border-radius: 24rpx;
                padding: 25rpx;
                margin: 0 30rpx 20rpx;
                .tu{
                    width: 180rpx;
                    height: 180rpx;
                    margin-right: 20rpx;
                    border-radius: 20rpx;
                }
                .menone{
                    display: flex;
                    flex-direction: column;
                    width: 68%;
                    height: 100%;
                    .menhead{
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        .name{
                            font-weight: bold;
                            font-size: 32rpx;
                            color: #272727;
                        }
                        .yingye{
                            font-weight: 500;
                            font-size: 26rpx;
                            color: #24B924;
                        }
                        .yingtime{
                            font-weight: 500;
                            font-size: 26rpx;
                            color: #333333;
                            display: inline-block;
                            margin-left: 18rpx;
                        }
                        .icon_dw{
                            width:22rpx;
                            height: 24rpx;
                            margin-right: 8rpx;

                        }
                        .ju{
                            font-weight: 500;
                            font-size: 28rpx;
                            color: #1A1A1A;
                        }
                        .juli{
                            margin-left: 30rpx;
                            font-weight: 500;
                            font-size: 24rpx;
                            color: #999999;
                            display: inline-block;
                            max-width: 70%;
                        }
                    }
                    .mennav{
                        margin-top: 55rpx;
                    }
                }
            }
        // }
</style>
